package sort.selectionSort;

import helper.ArrayGenerator;
import helper.SortingHelper;
import model.Student;

public class SelectionSortTest {

    public static void main(String[] args) {

        Integer[] arr = {1, 4, 2, 3, 6, 5};
        SelectionSort.sort(arr);
        for (int i : arr) {
            System.out.print(i + " ");
        }

        System.out.println();

        Student[] students = {
                new Student("TT", 69)
                , new Student("LY", 66),
                new Student("Alice", 96),
                new Student("Bobo", 11)
        };
        SelectionSort.sort(students);
        for (Student student : students) {
            System.out.print(student.toString() + " ");
        }

        System.out.println();

        int n = 10000;
        Integer[] randomArray = ArrayGenerator.generatorRandomArray(n, n);
        long startTime = System.nanoTime();
        SelectionSort.sort(randomArray);
        long endTime = System.nanoTime();
        double time = (endTime - startTime) / 1000000000.0;
        System.out.println("time:" + time + "s");

        boolean sorted = SortingHelper.isSorted(randomArray);
        System.out.println("是否正确排序：" + sorted);

    }

}
